﻿using System.Linq.Expressions;
using Dyao.Book.Entity;

namespace Dyao.Book.Repository.Abstractions
{
    public interface IBookshelfRepository : IDataRepository<BookshelfEntity>
    {
        /// <summary>
        /// 根据用户编号获取书架列表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="userId">用户编号</param>
        /// <param name="selector">选择器</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<List<T>> GetListByUserIdAsync<T>(string userId, Expression<Func<BookshelfEntity, T>> selector, CancellationToken cancellationToken);

        /// <summary>
        /// 修改最后阅读章节
        /// </summary>
        /// <param name="userId">当前用户编号</param>
        /// <param name="dto">传输对象</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns></returns>
        Task<BookshelfEntity> GetByUserIdAsync(string userId, string bookId, CancellationToken cancellationToken);
    }
}
